package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/11/1.
 */
@HttpInlet(Conn.APISDK_IDCARD)
public class PostIDCard extends BaseAsyPost<PostIDCard.IdCardInfoEntity> {

    public String userid, time, lock, base;

    public PostIDCard(AsyCallBack<IdCardInfoEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected IdCardInfoEntity parser(JSONObject object) {


        if (object.optInt("code") == 200) {

            IdCardInfoEntity idCardInfoEntity = new IdCardInfoEntity();

            JSONObject entityObject = object.optJSONObject("data");


            idCardInfoEntity.code = entityObject.optString("code");
            idCardInfoEntity.result = entityObject.optString("result");
            idCardInfoEntity.name = entityObject.optString("name");
            idCardInfoEntity.gender = entityObject.optString("gender");
            idCardInfoEntity.people = entityObject.optString("people");
            idCardInfoEntity.byear = entityObject.optString("byear");
            idCardInfoEntity.bday = entityObject.optString("bday");
            idCardInfoEntity.bmonth = entityObject.optString("bmonth");
            idCardInfoEntity.address = entityObject.optString("address");
            idCardInfoEntity.idnumber = entityObject.optString("idnumber");
            idCardInfoEntity.authority = entityObject.optString("authority");
            idCardInfoEntity.validdate = entityObject.optString("validdate");
            idCardInfoEntity.left = entityObject.optString("left");
            idCardInfoEntity.top = entityObject.optString("top");
            idCardInfoEntity.right = entityObject.optString("right");
            idCardInfoEntity.bottom = entityObject.optString("bottom");
            idCardInfoEntity.age = entityObject.optString("age");


            return idCardInfoEntity;


        }


        TOAST = object.optString("message");

        return null;
    }

    @Override
    protected boolean skipSecret(String key) {

        return key.equals("base");
    }

    public static class IdCardInfoEntity {

        public String code, result, name, gender, people, byear, bmonth, bday, address, idnumber, authority, validdate, left, top, right, bottom, age;

    }


}
